home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / system-config-printer / installpackage.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-10-12  |  2.1 KB  |  51 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import dbus
  5. import xml.etree.ElementTree as xml
  6. from dbus.mainloop.glib import DBusGMainLoop
  7. DBusGMainLoop(set_as_default = True)
  8.  
  9. class PackageKit:
  10.     
  11.     def __init__(self):
  12.         bus = dbus.SessionBus()
  13.         obj = bus.get_object('org.freedesktop.PackageKit', '/org/freedesktop/PackageKit')
  14.         num_args = -1
  15.         introsp = dbus.Interface(obj, 'org.freedesktop.DBus.Introspectable')
  16.         api = introsp.Introspect()
  17.         top = xml.etree.ElementTree.XML(api)
  18.         for interface in top.findall('interface'):
  19.             if interface.attrib.get('name') != 'org.freedesktop.PackageKit':
  20.                 continue
  21.             
  22.             for method in interface.findall('method'):
  23.                 if method.attrib.get('name') != 'InstallPackageName':
  24.                     continue
  25.                 
  26.                 num_args = len(method.findall('arg'))
  27.             
  28.         
  29.         if num_args == -1:
  30.             raise RuntimeError, 'Introspection failed for PackageKit'
  31.         num_args == -1
  32.         self.proxy = dbus.Interface(obj, 'org.freedesktop.PackageKit')
  33.         self.num_args = num_args
  34.  
  35.     
  36.     def InstallPackageName(self, xid, timestamp, name):
  37.         proxy = self.proxy
  38.         if self.num_args == 3:
  39.             return proxy.InstallPackageName(xid, timestamp, name, reply_handler = self.reply_handler, error_handler = self.error_handler)
  40.         return proxy.InstallPackageName(name, reply_handler = self.reply_handler, error_handler = self.error_handler)
  41.  
  42.     
  43.     def reply_handler(self, *args):
  44.         pass
  45.  
  46.     
  47.     def error_handler(self, *args):
  48.         pass
  49.  
  50.  
  51.